<?=
get_toolbar(array('accion' => 'custom',
    'botones' => '<a href="' . site_url(get_uri_string() . "/paso1") . '" class="btn btn-success color-blanco">' . ulang('crear_un_nuevo_anuncio') . '</a>'));
?>
<?= get_alert(isset($success) ? $success : null, isset($error) ? $error : null); ?>
<div class="row">
    <div class="col-md-12">
        <!-- BEGIN SAMPLE TABLE PORTLET-->
        <div class="portlet box red">
            <div class="portlet-title">
                <div class="caption"><i class="icon-cogs"></i><?= ulang('tus_anuncios') ?></div>
                <div class="tools">
                    <a href="javascript:;" class="collapse"></a>
                </div>
            </div>
            <div class="portlet-body">
                <div class="table-scrollable">
                    <table class="table table-hover">
                        <thead>
                            <tr>
                                <th class="col-md-2"><?= ulang('acciones') ?></th>
                                <th><?= ulang('pro_titulo') ?></th>
                                <th><?= ulang('ppz_fk_prod_razas') ?></th>
                                <th><?= ulang('pro_fec_nacimiento') ?></th>
                                <th><?= ulang('mascota') ?></th>
                                <th class="col-md-1"><?= ulang('emp_estado') ?></th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php foreach ($query as $producto) { ?>
                                <tr>
                                    <td>
                                        <a class="btn btn-xs blue" href="<?= site_url(PANEL . $globals['url_base'] . "/paso1/id/" . $producto['pro_id']); ?>">
                                            <i class="icon-pencil"></i>
                                            Editar
                                        </a>
                                        <a class="btn btn-xs red" href="<?= site_url(PANEL . $globals['url_base'] . "/borrar/id/" . $producto['pro_id']) ?>" onclick="return confirm('<?= lang('mensaje_confirm_borrar') ?>')">
                                            <i class="icon-remove"></i>
                                            Borrar
                                        </a>
                                        <a class="btn btn-xs yellow" href="<?= site_url(PANEL . $globals['url_base'] . "/duplicar/id/" . $producto['pro_id']); ?>">
                                            <i class="icon-copy"></i>
                                            Duplicar
                                        </a>
                                    </td>
                                    <td><?= $producto['pro_titulo'] ?></td>
                                    <td>
                                        <?php
                                        $razas = array();
                                        foreach ($producto['d_razas'] as $raz) {
                                            $razas[] = lang($raz['prz_slug']);
                                        }
                                        echo implode(",", $razas);
                                        ?>
                                    </td>
                                    <td><?=$this->fechas->fec_mysql_to_str($producto['pro_fec_nacimiento'])?></td>
                                    <td><?=ulang($producto['pst_slug'])?></td>
                                    <td>
                                        <?php if ($producto['pro_estado'] == 'P') { ?>
                                            <?php if($this->session->userdata('usu_fk_rol') < 3){?>
                                                <a href="<?=site_url(PANEL.'usuario/activar_empresa/'.$producto['pro_id'])?>">
                                            <?php }?>
                                                <span class="label label-sm label-warning">Pendiente</span>
                                            <?php if($this->session->userdata('usu_fk_rol') < 3){?>
                                                </a>
                                            <?php }?>
                                        <?php } else if ($producto['pro_estado'] == 'A') { ?>
                                            <?php if($this->session->userdata('usu_fk_rol') < 3){?>
                                                <a href="<?=site_url(PANEL.'usuario/desactivar_empresa/'.$producto['pro_id'])?>">
                                            <?php }?>
                                                <span class="label label-sm label-success">Activo</span>
                                            <?php if($this->session->userdata('usu_fk_rol') < 3){?>
                                                </a>
                                            <?php }?>
                                        <?php } ?>
                                    </td>
                                </tr>
                            <?php } ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <!-- END SAMPLE TABLE PORTLET-->
    </div>
</div>